﻿using System.Collections.Generic;
using System.Windows;
using VNet.VisiSuite.VisiBoard.Common.Helpers;
using VNet.VisiSuite.VisiBoard.Dal.EntityClasses;
using VNet.VisiSuite.VisiBoard.Models;

namespace VNet.VisiSuite.VisiBoard.ViewModels
{
    public class ScrapDialogViewModel : DialogViewModel
    {
        #region Fields
        private ScrapDialogModel _model;
        private Visibility _visibility;

        #endregion

        public ScrapDialogViewModel()
        {
            _visibility = Visibility.Visible;
            Heading = "Scrap";
            Model = new ScrapDialogModel();
            ScrapQuantity = 1;
        }

        #region Properties

        public IEnumerable<dynamic> ProductionPlanData
        {
            get
            {
                if (_model == null)
                    return null;
                return _model.ProductionPlanData;
            } 
        }

        public double ScrapQuantity { get; set; }

        public IEnumerable<SimpleNode> ScrapReasonCodes
        {
            get
            {
                if (_model == null)
                    return new List<SimpleNode>();
                return _model.ScrapReasonCodes;
            } 
        }


        public ScrapDialogModel Model
        {
            get { return _model; }
            set
            {
                _model = value;
                OnPropertyChanged("Model");
            }
        }


        public Visibility Visibility
        {
            get { return _visibility; }
            set
            {
                _visibility = value;
                OnPropertyChanged("Visibility");
            }
        }

        #endregion


    }
}
